//
//  EditController.m
//  UITableViewRowAction
//
//  Created by KM on 16/11/8.
//  Copyright © 2016年 KM. All rights reserved.
//

#import "EditController.h"

@interface EditController()
@property (weak, nonatomic) IBOutlet UITextField *sugar;

@end

@implementation EditController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.sugar becomeFirstResponder];
    UIToolbar *tool = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
    UIBarButtonItem *item1 = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(endEdit:)];
    UIBarButtonItem *space = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    tool.items = @[space,item1];
    self.sugar.inputAccessoryView = tool;
}

- (void)endEdit:(id)sender
{
    [self.view endEditing:YES];
}
@end
